export class DashLine {
  // eslint-disable-next-line @typescript-eslint/naming-convention
  public static readonly EDGE_NAME = 'line-dash';
  // eslint-disable-next-line @typescript-eslint/naming-convention
  public static readonly EDGE_DEFINTION = {
    afterDraw(cfg, group: any) {
      // get the first shape in the group, it is the edge's path here=
      const shape = group.get('children')[0];
      let index = 0;
      // Define the animation
      shape.animate(
        () => {
          index++;
          if (index > 9) {
            index = 0;
          }
          const res = {
            lineDash: [4, 2, 1, 2],
            lineDashOffset: -index,
          };
          // returns the modified configurations here, lineDash and lineDashOffset here
          return res;
        },
        {
          repeat: true, // whether executes the animation repeatly
          duration: 3000, // the duration for executing once
        }
      );
    },
  };
  // eslint-disable-next-line @typescript-eslint/naming-convention
  public static readonly EXTEND_EDGE = 'cubic-vertical';
}
